package traveldream.ejb.DTO;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

public class HotelDTO {
	private int id;
	
	@Length(max=31,message = "You have exceded max number of car")
	@NotEmpty(message = "You must specify a Name")
	private String name;
	
	@Min(value=1)
	private int availablePlaces;
	
	@Length(max=63,message = "You have exceded max number of car")
	@NotEmpty(message = "You must specify a Description")
	private String description;
	
	@Length(max=31,message = "You have exceded max number of car")
	@NotEmpty(message = "You must specify a WebSite")
	private String website;
	
	@Length(max=31,message = "You have exceded max number of car")
	@Pattern(regexp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*" +
            "@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",
            message="invalid email")
	private String email;
	
	@Length(max=31,message = "You have exceded max number of car")
	@Pattern(regexp = "(^[a-zA-Z]+$)",
            message = "You must specify a City")
	private String city;
	
	@Max(value = 5) 
	@Min(value = 1)
	private int stars;
	
	@Length(max=31,message = "You have exceded max number of car")
	@NotEmpty(message = "You must specify a Address")
	private String address;
	
	@Length(max=13,message = "You have exceded max number of car")
	@Pattern(regexp = "(^[0-9]+$)",
            message = "You must specify a Phone Number")
	private String phone;
	
	@Min(value = 1)
	private int price;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAvailablePlaces() {
		return availablePlaces;
	}
	public void setAvailablePlaces(int availablePlaces) {
		this.availablePlaces = availablePlaces;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getWebsite() {
		return website;
	}
	public void setWebsite(String website) {
		this.website = website;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public int getStars() {
		return stars;
	}
	public void setStars(int stars) {
		this.stars = stars;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	
	public boolean equals(HotelDTO h){
		return h.address.equals(address) && h.availablePlaces == availablePlaces && h.city.equals(city) && h.description.equals(description) && h.email.equals(email)
				&& h.name.equals(name) && h.phone.equals(phone) && h.price == price && h.stars == stars && h.website.equals(website);
	}
	
}
